Skip to content

Certify G scaling of the helicity masks on Python 3.14 - #531

Open
oliviermattelaer wants to merge 1 commit into
mainfrom
fix/helicity-degrees-py314
Open

oliviermattelaer wants to merge 1 commit into
mainfrom
fix/helicity-degrees-py314

Conversation

@oliviermattelaer

Copy link
Copy Markdown
Contributor

Problem

On Python 3.14, NLO outputs never certify the G scaling of their helicity masks: Source/BornSupport/helicity_signature.json gets "mode": "exact_compact_state" instead of "homogeneous_G". As a result, with a dynamical scale every Born and real-emission call relearns its helicity mask, summing all helicities, each time alpha_s changes.

The cause is born_support.helicity_coupling_degrees, which recognised numeric literals with ast.Num. Python 3.14 removed that alias. The resulting AttributeError is caught as an "unsupported expression", so every coupling comes out with an unknown degree. Python 3.13 and older are not affected. That is why main looked fine on the cluster (Python 3.13) but not on a Python 3.14 laptop.

Fix

Numeric literals are now tested as ast.Constant with an int, float or complex value. This is the same change as the corresponding hunk of 3505311 in #512, split out so that main gets it now.

Tests

  • test_sm_and_heft_coupling_degrees already failed on main under Python 3.14 (9 subtest failures). CI runs an older Python, so it did not see this.
  • New test test_coupling_degrees_without_removed_ast_aliases: it reruns the same cases with ast.Num, ast.Str, ast.Bytes, ast.NameConstant and ast.Ellipsis hidden, so it catches a reintroduction on any Python version.
  • Without the fix, the new test fails on Python 3.12. With the fix, both tests pass on 3.12 and on 3.14.

🤖 Generated with Claude Code

helicity_coupling_degrees recognised numeric literals with ast.Num,
which Python 3.14 removed. The AttributeError was caught as an
unsupported expression, so every coupling came out of unknown degree
and no NLO output certified homogeneous_G: with a dynamical scale each
Born and real-emission call relearned its helicity mask at every
change of alpha_s. Test numeric literals as ast.Constant instead.

The existing coupling-degree test already failed on Python 3.14; the
new test hides the removed aliases so that CI on older Pythons catches
a reintroduction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

How CI reacts to this PR

  • Not a draft: the full CI runs automatically when the PR is opened and on every push.
  • Draft: only the unittest and IOtest workflows run. Mark the PR "Ready for review" to start the full CI.
  • run-ci label: while this label is on the PR, every job keeps running after a failure, so you see all failures. Without it, the first failing job cancels the other runs of that commit.
  • Closing or merging: the unfinished CI runs of this PR are cancelled. A merge gets its own run on main.
  • Pushes to main: the full CI runs after each merge.
  • Other branches: run CI only through workflow_dispatch.
  • Forks: the runs use a read-only token, so they cannot cancel each other.
  • Merge: a green CI and one approval are required to merge.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant